/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elderberryni2.datareader;

import elderberryni2.interfaces.IDataReadable;

/**
 *
 * @author warringer
 */
public class TestModeReader implements IDataReadable{
    
    private boolean paused = false;
    private int counter = 0;
    private int timer = 0;
    
    @Override
    public String getData() {
        if (!paused) {
            String data = "";
            double rad = Math.toRadians(counter);
            String zero = new Double(0).toString();
            String vel  = new Double(1800 + 200 * Math.sin(rad)).toString();
            String alt  = new Double(180 + 20 * Math.sin(rad + Math.PI)).toString();
            String lat  = new Double(70 * Math.cos(rad)).toString();
            String lon  = new Double(Math.toDegrees(rad)).toString();
            data += zero + ";" + zero + ";" + zero + ";";   //Ang Velocity
            data += vel + ";" + vel + ";" + vel + ";";      //Lin Velocity
            data += zero + ";" + zero + ";" + zero + ";";   //Direction
            data += zero + ";" + zero + ";" + zero + ";" + zero + ";";   //Grav
            data += alt + ";" + alt + ";" + lat + ";" + lon + ";";      //Path Data
            data += "Kerbin;";
            data += zero + ";" + zero + ";" + zero + ";" + zero + ";";   //Pressure
            data += zero + ";";                             //Temp
            data += timer + ";" + timer + ";fr2234a;"; //Data
            data += "<EOT>";
            if (counter < 360) {
                counter++;
            } else {
                counter = 0;
            }
            timer++;
            return data;
        }
        return null;
    }

    @Override
    public void pauseData() {
        paused = true;
    }

    @Override
    public void unpauseData() {
        paused = false;
    }

    @Override
    public void close() {
    }
    
}
